<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>my rich text</title>
    <link rel="stylesheet" href="./MyRichTextInput.css" />
  </head>
  <body>
    <div style="height: 100vh"></div>
    <div class="mRichTextContainer">
      <div class="mRichTextExtendsContainer"></div>
      <div class="mRichTextSend">提交</div>
    </div>

    <div style="height: 100vh"></div>

    <script type="module">
      import MyRichTextInput from "./MyRichTextInput.js";

      const myRichTextInput = new MyRichTextInput(
        ".mRichTextContainer",
        ".mRichTextExtendsContainer"
      );
      myRichTextInput.use("emotion");
      myRichTextInput.use("upload");
      myRichTextInput.init();

      const uploadApi = () => {
        return new Promise((resolve) => resolve("UploadApi:----"));
      };

      myRichTextInput.fileInsert(uploadApi).then((res) => {
        console.log("----AAA file insert--");
        console.log(res);
      });

      document.querySelector(".mRichTextSend").onclick = function () {
        const content = myRichTextInput.contentGet();
        console.log("RT:content:" + content);
      };
    </script>
  </body>
</html>
